Skip to content

Mockgun: honour limit and page in find - #468

Open
patrickwolf wants to merge 1 commit into
shotgunsoftware:masterfrom
patrickwolf:mockgun-limit-and-page
Open

patrickwolf wants to merge 1 commit into
shotgunsoftware:masterfrom
patrickwolf:mockgun-limit-and-page

Conversation

@patrickwolf

Copy link
Copy Markdown

Problem

Mockgun.find accepts limit and page but ignores them and returns every match. Code that asks for "the newest three Versions" gets all of them, so it can pass under Mockgun and answer differently on a real site.

Change

  • limit and page are applied after the ordering, as on the server: limit alone returns the first limit records; page returns that page, of limit records, or of 500 records (the server's default api_max_entities_per_page) when no limit is given.
  • They are validated as Shotgun.find validates them: a negative or non-int value raises ValueError.
  • find_one passes limit=1.

Tests

TestLimitAndPage: limit, pages including one past the end, limit after a descending order, and invalid values.

python -m pytest tests/test_mockgun.py

Merge order

Independent of the other Mockgun PRs (field types, default value types, upload), but each of them also adds its test class at the end of tests/test_mockgun.py, and "field types" also adds a constant next to this one's below the imports of mockgun.py. Whichever is merged later needs a rebase that keeps both sides.

find accepted limit and page and returned every match. They are now applied after the ordering, with the same validation as Shotgun.find; a page without a limit holds 500 records, the server's default. find_one asks for one record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickwolf
patrickwolf force-pushed the mockgun-limit-and-page branch from 79d3780 to 1e16ad5 Compare November 16, 2026 17:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant